/*
 * SystemFontsManager.h
 *
 *  Created on: 2009/02/12
 *      Author: Yongshik Cho
 */

#ifndef SYSTEMFONTSMANAGER_H_
#define SYSTEMFONTSMANAGER_H_

#include <vector>
#include "core/Prerequisites.h"
#include "core/ISingleton.h"


class SystemFontsManager : public ISingleton<SystemFontsManager>
{
public:
	SystemFontsManager();
	virtual ~SystemFontsManager();

public:
	static SystemFontsManager& GetInstance()
	{
		assert(m_pInstance);
		return *m_pInstance;
	}
	static SystemFontsManager* GetInstancePtr()
	{
		return m_pInstance;
	}

public:
	void selectTruetypeFont(uint32 index = 0);
	void selectFont(const LOGFONT& lf);
	LOGFONT* getLogFontByName(const String& face);

private:
	void checkSystemFonts();
	static BOOL CALLBACK emumSystemFontCallback(LPLOGFONT lplf, LPNEWTEXTMETRIC lpntm, DWORD fontType, LPVOID fontLists);

private:
	typedef pair<LOGFONT, NEWTEXTMETRIC>	SystemFontType;
	typedef vector<SystemFontType>			SystemFontListType;
	SystemFontListType			mRasterTypeFonts;
	SystemFontListType			mTrueTypeFonts;
	SystemFontListType			mOtherTypeFonts;

	bool						mFirst;
	HFONT						mDeviceContextFont;
	HFONT						mFont;
	LOGFONT						mLogFont;
};

#endif /* SYSTEMFONTSMANAGER_H_ */
